package cn.fanxin.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;

/**
 * @Author: china-fanxin
 * @Website: https://fan-xin.cn
 * @Description: 可以进行汇总计算的列枚举
 * @Date: 2022/11/25 10:20
 * @Param:
 * @return:
 */
public enum GroupByEnum {

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description:
     * @Date: 2022/11/25 10:21
     * @Param:
     * @return:
     */
    DATE_ID("DATE_ID"),
    MONTH_ID("MONTH_ID"),
    DAY_ID("DAY_ID"),
    PROV_ID("PROV_ID"),
    AREA_ID("AREA_ID"),
    PROV_NAME("PROV_NAME"),
    AREA_NAME("AREA_NAME");

    GroupByEnum(String value){
        this.value = value;
    }

    private String value;


    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 返回支持group by的地市级汇总字段类型
     * @Date: 2022/11/25 10:27
     * @Param: []
     * @return: java.util.List<java.lang.String>
     */
    public static List<String> toList(){
        List<String> resList = new ArrayList<>();
        for (GroupByEnum values:GroupByEnum.values()){
            resList.add(values.getValue());
        }
        return resList;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 返回支持group by的地市级汇总字段类型
     * @Date: 2022/11/25 10:27
     * @Param: []
     * @return: java.util.List<java.lang.String>
     */
    public static List<String> toAreaList(){
        List<String> resList = new ArrayList<>();
        resList.add(DATE_ID.getValue());
        resList.add(MONTH_ID.getValue());
        resList.add(DAY_ID.getValue());
        resList.add(PROV_ID.getValue());
        resList.add(AREA_ID.getValue());
        resList.add(PROV_NAME.getValue());
        resList.add(AREA_NAME.getValue());
        return resList;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 返回支持group by的地市级汇总字段类型
     * @Date: 2022/11/25 10:27
     * @Param: []
     * @return: java.util.List<java.lang.String>
     */
    public static List<String> toProvList(){
        List<String> resList = new ArrayList<>();
        resList.add(DATE_ID.getValue());
        resList.add(MONTH_ID.getValue());
        resList.add(DAY_ID.getValue());
        resList.add(PROV_ID.getValue());
        resList.add(PROV_NAME.getValue());
        return resList;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 返回支持group by的地市级汇总字段类型
     * @Date: 2022/11/25 10:27
     * @Param: []
     * @return: java.util.List<java.lang.String>
     */
    public static List<String> toAllList(){
        List<String> resList = new ArrayList<>();
        resList.add(DATE_ID.getValue());
        resList.add(MONTH_ID.getValue());
        resList.add(DAY_ID.getValue());
        resList.add(PROV_ID.getValue());
        resList.add(PROV_NAME.getValue());
        return resList;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 返回在进行汇总计算时不同情形下的对应值
     * @Date: 2022/11/26 22:55
     * @Param: []
     * @return: java.util.HashMap<java.lang.String,java.lang.String>
     */
    public static HashMap<String ,String> toAreaMap(){
        HashMap<String, String> provMap = new HashMap<>();
        provMap.put(DATE_ID.value,DATE_ID.value);
        provMap.put(MONTH_ID.value,MONTH_ID.value);
        provMap.put(DAY_ID.value,DAY_ID.value);
        provMap.put(AREA_ID.value,AREA_ID.value);
        provMap.put(AREA_NAME.value,AREA_NAME.value);
        provMap.put(PROV_ID.value,PROV_ID.value);
        provMap.put(PROV_NAME.value,PROV_NAME.value);
        return provMap;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 返回在进行汇总计算时不同情形下的对应值
     * @Date: 2022/11/26 22:55
     * @Param: []
     * @return: java.util.HashMap<java.lang.String,java.lang.String>
     */
    public static HashMap<String ,String> toProvMap(){
        HashMap<String, String> provMap = new HashMap<>();
        provMap.put(DATE_ID.value,DATE_ID.value);
        provMap.put(MONTH_ID.value,MONTH_ID.value);
        provMap.put(DAY_ID.value,DAY_ID.value);
        provMap.put(AREA_ID.value,"'-1'");
        provMap.put(AREA_NAME.value,"'合计'");
        provMap.put(PROV_ID.value,PROV_ID.value);
        provMap.put(PROV_NAME.value,PROV_NAME.value);
        return provMap;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 返回在进行汇总计算时不同情形下的对应值
     * @Date: 2022/11/26 22:55
     * @Param: []
     * @return: java.util.HashMap<java.lang.String,java.lang.String>
     */
    public static HashMap<String ,String> toAllMap(){
        HashMap<String, String> provMap = new HashMap<>();
        provMap.put(DATE_ID.value,DATE_ID.value);
        provMap.put(MONTH_ID.value,MONTH_ID.value);
        provMap.put(DAY_ID.value,DAY_ID.value);
        provMap.put(AREA_ID.value,"'-1'");
        provMap.put(AREA_NAME.value,"'合计'");
        provMap.put(PROV_ID.value,"'111'");
        provMap.put(PROV_NAME.value,"'全国'");
        return provMap;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 返回在进行汇总计算时不同情形下的对应值
     * @Date: 2022/11/26 22:55
     * @Param: []
     * @return: java.util.HashMap<java.lang.String,java.lang.String>
     */
    public static HashMap<String ,String> toNorthMap(){
        HashMap<String, String> provMap = new HashMap<>();
        provMap.put(DATE_ID.value,DATE_ID.value);
        provMap.put(MONTH_ID.value,MONTH_ID.value);
        provMap.put(DAY_ID.value,DAY_ID.value);
        provMap.put(AREA_ID.value,"'-1'");
        provMap.put(AREA_NAME.value,"'合计'");
        provMap.put(PROV_ID.value,"'112'");
        provMap.put(PROV_NAME.value,"'北10");
        return provMap;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 返回在进行汇总计算时不同情形下的对应值
     * @Date: 2022/11/26 22:55
     * @Param: []
     * @return: java.util.HashMap<java.lang.String,java.lang.String>
     */
    public static HashMap<String ,String> toSouthMap(){
        HashMap<String, String> provMap = new HashMap<>();
        provMap.put(DATE_ID.value,DATE_ID.value);
        provMap.put(MONTH_ID.value,MONTH_ID.value);
        provMap.put(DAY_ID.value,DAY_ID.value);
        provMap.put(AREA_ID.value,"'-1'");
        provMap.put(AREA_NAME.value,"'合计'");
        provMap.put(PROV_ID.value,"'113'");
        provMap.put(PROV_NAME.value,"'南21'");
        return provMap;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 枚举值转为逗号分隔的字符串
     * @Date: 2022/11/24 15:10
     * @Param: []
     * @return: java.lang.String
     */
    public static String toDefString() {
        String res ="";
        for (GroupByEnum value: GroupByEnum.values()){
            res = res +value.getValue()+",";
        }
        res = res.substring(0,res.length()-1);
        return res;
    }
}
